<%@ page contentType="text/html;charset=UTF-8" trimDirectiveWhitespaces="true"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<c:set var="extLibs" value="validate"/>
<sys:header title="企业管理 - ${mdmBtypeInfo.isNewRecord ? '新增' : '编辑'}企业" extLibs="${extLibs}"/>
<div class="portlet box ${boxStyleColor} autoHeight">
	<div class="portlet-title">
		<div class="caption"><i class="fa fa-coffee"></i>${mdmBtypeInfo.isNewRecord ? '新增' : '编辑'}企业</div>
		<%-- <div class="actions">
			<shiro:hasPermission name="mdm:mdmBtypeInfo:edit">
				<a href="#" class="btn btn-default btn-sm" onclick="$('#btnSubmit').click();return false;"><i class="fa fa-check"></i> 保 存</a>
			</shiro:hasPermission>
			<a href="#" class="btn btn-default btn-sm" onclick="$('#btnCancel').click();return false;"><i class="fa fa-reply-all"></i> 关 闭</a>
		</div> --%>
	</div>
	<div class="portlet-body form">
		<form:form id="inputForm" modelAttribute="mdmBtypeInfo" action="${ctx}/mdm/mdmBtypeInfo/save" method="post" class="form-horizontal">
			<div class="form-body">
				<h4 class="form-section">基本信息</h4>
				<form:hidden path="id"/>
				<div class="row">

					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> 企业名称：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<form:input path="btypeName" htmlEscape="false" maxlength="100" class="form-control required"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> 企业编码：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<form:input path="btypeCode" htmlEscape="false" maxlength="100" class="form-control required"/>
							</div>
						</div>
					</div>

				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								分类：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<form:hidden path="classifyName"/>

								<form:select path="classifyCode" class="form-control">
									<form:option value="" label=""/>
									<form:options items="${fns:getDictList('btype_classify')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
								</form:select>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								区域：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<form:hidden path="areaName"/>

								<form:select path="areaCode" class="form-control">
									<form:option value="" label=""/>
									<form:options items="${fns:getDictList('btype_area')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
								</form:select>
							</div>
						</div>
					</div>

				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								类型：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<form:hidden path="typeName"/>

								<form:select path="typeCode" class="form-control">
									<form:option value="" label=""/>
									<form:options items="${fns:getDictList('btype_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
								</form:select>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								用电规模：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<form:hidden path="scaleName"/>

								<form:select path="scaleCode" class="form-control">
									<form:option value="" label=""/>
									<form:options items="${fns:getDictList('btype_scale')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
								</form:select>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								联系人：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<form:input path="linkman" htmlEscape="false" maxlength="64" class="form-control"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								联系方式：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<form:input path="linkmanTel" htmlEscape="false" maxlength="64" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								上年总用电量：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<form:input path="lastYearElectricQuantity" htmlEscape="false" class="form-control number"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								变压器容量：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<form:input path="transformerCapacity" htmlEscape="false" class="form-control number"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								直供容量：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<form:input path="directCapacity" htmlEscape="false" class="form-control number"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								最大容量：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<form:input path="maxCapacity" htmlEscape="false" class="form-control number"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								自备电源：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<form:input path="oneselfPower" htmlEscape="false" maxlength="64" class="form-control"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								备案状态：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<form:input path="recordsStatus" htmlEscape="false" maxlength="64" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								电压等级：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<form:hidden path="voltageClassName"/>
								<form:select path="voltageClassCode" class="form-control">
									<form:option value="" label=""/>
									<form:options items="${fns:getDictList('voltageClassCode')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
								</form:select>
							</div>
						</div>
					</div>

				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								备注信息：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="form-actions fluid">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<shiro:hasPermission name="mdm:mdmBtypeInfo:edit">
							<button id="btnSubmit" type="submit" class="btn btn-primary"><i class="fa fa-check"></i> 保 存</button>&nbsp;
						</shiro:hasPermission>
						<button id="btnCancel" type="button" class="btn default" onclick="closeCurrentTabPage('${param.parentTabPageId}')"><i class="fa fa-reply-all"></i> 关 闭</button>
					</div>
				</div>
			</div>
		</form:form>
	</div>
</div>
<sys:footer extLibs="${extLibs}"/>
<script type="text/javascript">

	$("#inputForm").validate({
		submitHandler: function(form){
			alert($("#areaCode").val());
			if($("#areaCode").val()!=null&&$("#areaCode").val()!=''){
				$("#areaName").val($("#areaCode").select2("data").text);
			}
			if($("#classifyCode").val()!=null&&$("#classifyCode").val()!=''){
				$("#classifyName").val($("#classifyCode").select2("data").text);
			}
			if($("#voltageClassCode").val()!=null&&$("#voltageClassCode").val()!=''){
				$("#voltageClassName").val($("#voltageClassCode").select2("data").text);
			}
			if($("#typeCode").val()!=null&&$("#typeCode").val()!=''){
				$("#typeName").val($("#typeCode").select2("data").text);
			}
			if($("#scaleCode").val()!=null&&$("#scaleCode").val()!=''){
				$("#scaleName").val($("#scaleCode").select2("data").text);
			}
			if($("#scaleCode").val()!=null&&$("#scaleCode").val()!=''){
				$("#scaleName").val($("#scaleCode").select2("data").text);
			}
			ajaxSubmitForm($(form), function(data){
				showMessage(data.message);
				if(data.result == Global.TRUE){
					closeCurrentTabPage('${param.parentTabPageId}', function(contents, contentWindow){
						contentWindow.page();
					});
				}
			}, "json");
	    }
	});
</script>
